package com.app.ui.view.list;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ListView;

/**
 * Created by 郭敏 on 2017/12/13 0013.
 */

public class BaseLisetView extends ListView {
    public BaseLisetView(Context context) {
        super(context);

    }

    public BaseLisetView(Context context, AttributeSet attrs) {
        super(context, attrs);

    }

    public BaseLisetView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

    }

    /**
     * 指定跳转至到tem
     *
     * @param index item索引
     */
    public void postSetSelection(final int index) {
        post(new Runnable() {
            @Override
            public void run() {
                setSelection(index);

            }
        });
    }

    /**
     * 指定滑动到item
     *
     * @param index item索引
     */
    public void postSmoothScrollToPosition(final int index) {
        post(new Runnable() {
            @Override
            public void run() {
                smoothScrollToPosition(index);

            }
        });
    }

}
